import 'package:flutter/material.dart';
import 'package:vc_package/widget/extension.dart';
import 'package:vc_package/widget/text_view.dart';

import '../utils/base_color_utils.dart';
import 'clickable.dart';

class NormalBottomButton extends StatelessWidget {
  final String? title;
  final bool? showShadow;
  final Function()? onTap;

  const NormalBottomButton(
      {super.key, this.title, this.onTap, this.showShadow = false});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius:
            BorderRadius.only(topLeft: 10.radius, topRight: 10.radius),
        boxShadow: [
          BoxShadow(
            color: showShadow == true
                ? ColorUtils.blackNormal.withOpacity(0.05)
                : ColorUtils.transparent,
            offset: const Offset(0.0, -1.0), //阴影y轴偏移量
            blurRadius: 2, //阴影模糊程度
            spreadRadius: 1, //阴影扩散程度
          ),
        ],
      ),
      child: SafeArea(
        top: false,
        child: Clickable(
          splashColor: ColorUtils.transparent,
          onTap: onTap,
          child: Container(
            margin: EdgeInsets.only(
                left: 18.fit, right: 18.fit, top: 15.fit, bottom: 12.fit),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(
                4.radius,
              ),
              gradient: LinearGradient(
                  begin: Alignment.centerLeft,
                  end: Alignment.centerRight,
                  colors: ['#66A2FE'.toColor(), ColorUtils.blue]),
            ),
            child: TextView(
              title,
              size: 16.fit,
              fontWeight: FontWeight.w600,
              alignment: Alignment.center,
              color: Colors.white,
              margin: EdgeInsets.only(top: 10.fit, bottom: 10.fit),
            ),
          ),
        ),
      ),
    );
  }
}
